rm(list=ls())
library(readstata13)
library(lfe)
library(sensemakr)
library(EValue)
setwd("C:/Users/m1049/Dropbox/CPS Replication Final")

# road
df<-read.dta13("main.dta")

ols = lm(road ~ treatment_binary + as.factor(st) +as.factor(year), data=df)
est = ols$coefficients[2]
sd = summary(ols)$sigma
summary(evalue(OLS(est, sd)))

road.sensitivity <- sensemakr(model = ols, 
                              treatment = "treatment_binary")


road.sensitivity

# community

ols = lm(lib ~ treatment_binary + as.factor(st) +as.factor(year), data=df)
est = ols$coefficients[2]
sd = summary(ols)$sigma
summary(evalue(OLS(est, sd)))

lib.sensitivity <- sensemakr(model = ols, 
                             treatment = "treatment_binary")

lib.sensitivity

ols = lm(center ~ treatment_binary+ as.factor(st) +as.factor(year), data=df)
est = ols$coefficients[2]
sd = summary(ols)$sigma
summary(evalue(OLS(est, sd)))

center.sensitivity <- sensemakr(model = ols, 
                                treatment = "treatment_binary")

center.sensitivity

# storage

ols = lm(max ~ treatment_binary+treatment+post + as.factor(st) +as.factor(year), data=df)
est = ols$coefficients[2]
sd = summary(ols)$sigma
summary(evalue(OLS(est, sd)))


storage.sensitivity <- sensemakr(model = ols, 
                                 treatment = "treatment_binary")

storage.sensitivity
